home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / ncurses-5.3.lha / ncurses-5.3 / Ada95 / src / terminal_interface-curses-panel < prev    next >
Text File  |  2002-10-24  |  6KB  |  166 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                           GNAT ncurses Binding                           --
  4. --                                                                          --
  5. --                      Terminal_Interface.Curses.Panels                    --
  6. --                                                                          --
  7. --                                 B O D Y                                  --
  8. --                                                                          --
  9. ------------------------------------------------------------------------------
  10. -- Copyright (c) 1998 Free Software Foundation, Inc.                        --
  11. --                                                                          --
  12. -- Permission is hereby granted, free of charge, to any person obtaining a  --
  13. -- copy of this software and associated documentation files (the            --
  14. -- "Software"), to deal in the Software without restriction, including      --
  15. -- without limitation the rights to use, copy, modify, merge, publish,      --
  16. -- distribute, distribute with modifications, sublicense, and/or sell       --
  17. -- copies of the Software, and to permit persons to whom the Software is    --
  18. -- furnished to do so, subject to the following conditions:                 --
  19. --                                                                          --
  20. -- The above copyright notice and this permission notice shall be included  --
  21. -- in all copies or substantial portions of the Software.                   --
  22. --                                                                          --
  23. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --
  24. -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --
  25. -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --
  26. -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --
  27. -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --
  28. -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --
  29. -- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --
  30. --                                                                          --
  31. -- Except as contained in this notice, the name(s) of the above copyright   --
  32. -- holders shall not be used in advertising or otherwise to promote the     --
  33. -- sale, use or other dealings in this Software without prior written       --
  34. -- authorization.                                                           --
  35. ------------------------------------------------------------------------------
  36. --  Author:  Juergen Pfeifer, 1996
  37. --  Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en
  38. --  Version Control:
  39. --  $Revision: 1.9 $
  40. --  Binding Version 01.00
  41. ------------------------------------------------------------------------------
  42. with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
  43. with Interfaces.C;
  44.  
  45. package body Terminal_Interface.Curses.Panels is
  46.  
  47.    use type Interfaces.C.int;
  48.  
  49.    function Create (Win : Window) return Panel
  50.    is
  51.       function Newpanel (Win : Window) return Panel;
  52.       pragma Import (C, Newpanel, "new_panel");
  53.  
  54.       Pan : Panel;
  55.    begin
  56.       Pan := Newpanel (Win);
  57.       if Pan = Null_Panel then
  58.          raise Panel_Exception;
  59.       end if;
  60.       return Pan;
  61.    end Create;
  62.  
  63.    procedure Bottom (Pan : in Panel)
  64.    is
  65.       function Bottompanel (Pan : Panel) return C_Int;
  66.       pragma Import (C, Bottompanel, "bottom_panel");
  67.    begin
  68.       if Bottompanel (Pan) = Curses_Err then
  69.          raise Panel_Exception;
  70.       end if;
  71.    end Bottom;
  72.  
  73.    procedure Top (Pan : in Panel)
  74.    is
  75.       function Toppanel (Pan : Panel) return C_Int;
  76.       pragma Import (C, Toppanel, "top_panel");
  77.    begin
  78.       if Toppanel (Pan) = Curses_Err then
  79.          raise Panel_Exception;
  80.       end if;
  81.    end Top;
  82.  
  83.    procedure Show (Pan : in Panel)
  84.    is
  85.       function Showpanel (Pan : Panel) return C_Int;
  86.       pragma Import (C, Showpanel, "show_panel");
  87.    begin
  88.       if Showpanel (Pan) = Curses_Err then
  89.          raise Panel_Exception;
  90.       end if;
  91.    end Show;
  92.  
  93.    procedure Hide (Pan : in Panel)
  94.    is
  95.       function Hidepanel (Pan : Panel) return C_Int;
  96.       pragma Import (C, Hidepanel, "hide_panel");
  97.    begin
  98.       if Hidepanel (Pan) = Curses_Err then
  99.          raise Panel_Exception;
  100.       end if;
  101.    end Hide;
  102.  
  103.    function Get_Window (Pan : Panel) return Window
  104.    is
  105.       function Panel_Win (Pan : Panel) return Window;
  106.       pragma Import (C, Panel_Win, "panel_window");
  107.  
  108.       Win : Window := Panel_Win (Pan);
  109.    begin
  110.       if Win = Null_Window then
  111.          raise Panel_Exception;
  112.       end if;
  113.       return Win;
  114.    end Get_Window;
  115.  
  116.    procedure Replace (Pan : in Panel;
  117.                       Win : in Window)
  118.    is
  119.       function Replace_Pan (Pan : Panel;
  120.                             Win : Window) return C_Int;
  121.       pragma Import (C, Replace_Pan, "replace_panel");
  122.    begin
  123.       if Replace_Pan (Pan, Win) = Curses_Err then
  124.          raise Panel_Exception;
  125.       end if;
  126.    end Replace;
  127.  
  128.    procedure Move (Pan    : in Panel;
  129.                    Line   : in Line_Position;
  130.                    Column : in Column_Position)
  131.    is
  132.       function Move (Pan    : Panel;
  133.                      Line   : C_Int;
  134.                      Column : C_Int) return C_Int;
  135.       pragma Import (C, Move, "move_panel");
  136.    begin
  137.       if Move (Pan, C_Int (Line), C_Int (Column)) = Curses_Err then
  138.          raise Panel_Exception;
  139.       end if;
  140.    end Move;
  141.  
  142.    function Is_Hidden (Pan : Panel) return Boolean
  143.    is
  144.       function Panel_Hidden (Pan : Panel) return C_Int;
  145.       pragma Import (C, Panel_Hidden, "panel_hidden");
  146.    begin
  147.       if Panel_Hidden (Pan) = Curses_False then
  148.          return False;
  149.       else
  150.          return True;
  151.       end if;
  152.    end Is_Hidden;
  153.  
  154.    procedure Delete (Pan : in out Panel)
  155.    is
  156.       function Del_Panel (Pan : Panel) return C_Int;
  157.       pragma Import (C, Del_Panel, "del_panel");
  158.    begin
  159.       if Del_Panel (Pan) = Curses_Err then
  160.          raise Panel_Exception;
  161.       end if;
  162.       Pan := Null_Panel;
  163.    end Delete;
  164.  
  165. end Terminal_Interface.Curses.Panels;
  166.